<template>
  <div class="page-container" :class="{ 'page-container--full-height': fullHeight }">
    <!-- 页面背景装饰 -->
    <div class="page-background"></div>
    
    <!-- 页面内容 -->
    <div class="page-content">
      <!-- 页面标题区域 -->
      <div v-if="title || $slots.header" class="page-header">
        <div v-if="title" class="page-title-section">
          <h1 class="page-title">{{ title }}</h1>
          <p v-if="description" class="page-description">{{ description }}</p>
        </div>
        <slot name="header"></slot>
      </div>
      
      <!-- 主要内容区域 -->
      <div class="page-main">
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
interface Props {
  title?: string
  description?: string
  fullHeight?: boolean
}

withDefaults(defineProps<Props>(), {
  fullHeight: false
})
</script>

<style scoped>
.page-container {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.page-container--full-height {
  height: 100vh;
}

.page-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 1200px 800px at 20% 10%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 800px 1200px at 80% 90%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
    linear-gradient(135deg, #0f172a 0%, #1e293b 25%, #334155 50%, #475569 75%, #64748b 100%);
  pointer-events: none;
}

.page-background::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 15% 25%, rgba(255, 255, 255, 0.6) 1px, transparent 1px),
    radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.4) 1px, transparent 1px),
    radial-gradient(circle at 35% 75%, rgba(255, 255, 255, 0.5) 1px, transparent 1px),
    radial-gradient(circle at 95% 65%, rgba(255, 255, 255, 0.3) 1px, transparent 1px),
    radial-gradient(circle at 5% 85%, rgba(255, 255, 255, 0.6) 1px, transparent 1px),
    radial-gradient(circle at 65% 35%, rgba(255, 255, 255, 0.4) 1px, transparent 1px);
  background-size: 300px 300px, 400px 400px, 350px 350px, 250px 250px, 320px 320px, 380px 380px;
  animation: sparkle 25s ease-in-out infinite;
}

.page-background::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.15) 0%,
      rgba(255, 255, 255, 0.1) 10%,
      rgba(255, 255, 255, 0.05) 20%,
      rgba(255, 255, 255, 0.02) 35%,
      transparent 50%
    );
  animation: lightBeam 30s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0.8;
    transform: scale(1) rotate(0deg);
  }
  25% {
    opacity: 0.6;
    transform: scale(1.05) rotate(15deg);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.95) rotate(30deg);
  }
  75% {
    opacity: 0.7;
    transform: scale(1.02) rotate(45deg);
  }
}

@keyframes lightBeam {
  0%, 100% {
    opacity: 0.8;
    transform: translateX(0) translateY(0) rotate(0deg);
  }
  25% {
    opacity: 1;
    transform: translateX(3px) translateY(-3px) rotate(0.3deg);
  }
  50% {
    opacity: 0.6;
    transform: translateX(-2px) translateY(2px) rotate(-0.3deg);
  }
  75% {
    opacity: 0.9;
    transform: translateX(2px) translateY(3px) rotate(0.2deg);
  }
}

.page-content {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 40px;
}

.page-title-section {
  text-align: center;
  margin-bottom: 32px;
}

.page-title {
  font-size: 48px;
  font-weight: 700;
  margin: 0 0 16px;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 50%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.page-description {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.page-main {
  position: relative;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .page-content {
    padding: 20px 16px;
  }
  
  .page-title {
    font-size: 32px;
  }
  
  .page-description {
    font-size: 16px;
  }
  
  .page-header {
    margin-bottom: 24px;
  }
}
</style>
